home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Demos
/
A.D. Software
/
OOFILE
/
Buildable, limited OOFILE
/
samples
/
ooftst01.inc
< prev
next >
Wrap
Text File
|
1996-02-18
|
2KB
|
67 lines
// included in ooftest1, 13, 14, 15 and 18
DECLARE_CLASS(dbPeople)
dbChar LastName, OtherNames;
dbLong Salary;
dbText Description;
dbDate LastPaid;
#ifndef demoNoIndexes
dbPeople() :
dbTable("People"),
LastName(39, "Last Name", kIndexCompress),
OtherNames(79, "Other Names", kIndexCompress),
Salary("Salary", kIndexed),
Description("Description"),
LastPaid("Last Paid", kIndexed)
{};
#else
dbPeople() :
dbTable("People"),
LastName(39, "Last Name"),
OtherNames(79, "Other Names"),
Salary("Salary"),
Description("Description"),
LastPaid("Last Paid", kIndexed)
{};
#endif
// my own data entry procedures
void Add(const char *lname, const char *oname, const long salary);
void AddTestData();
};
void dbPeople::Add(const char *lname, const char *oname, const long salary)
{
newRecord();
LastName = lname;
OtherNames = oname;
Salary = salary;
LastPaid.setDateToCurrentDate();
saveRecord();
}
void dbPeople::AddTestData()
{
Add("Smith", "John", 0); // specifically to test zero searches
Description = "John is a plain sort of bloke, not the kind to stand-out in a crowd\n";
Description += "and in fact you'd probably say he's the classic Mr Average. However ";
Description += "he harbours secret dreams of being a brain surgeon and a bloke 'wot ";
Description += "goes down the sewers in big rubber boots'\n";
LastPaid -= 21; // 3 weeks ago
saveRecord();
Add("Dent", "Trissa", 5000);
Description = "Trissa is married to Andy and mother of Tanith and Ryan";
saveRecord();
Add("Dent", "Andy", 25000);
Description = "Andy has a Don Quixote complex but is trying to strengthen his Sancho ";
Description += "Panza side to stop him before he gets into trouble,\n rather than taking ";
Description += "Herculean efforts to get him out of the overcommitted messes he creates.\n";
LastPaid -= 7; // 1 week ago
saveRecord();
Add("Taylor", "Ken", 75000);
}